import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.ContentType.TEXT
import static groovyx.net.http.Method.GET

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2010-11-20
 * Time: 12:02:09
 * To change this template use File | Settings | File Templates.
 */
class Grepper {
  def grep(url) {

// initialze a new builder and give a default URL
    def http = new HTTPBuilder(url)

    http.request(GET, TEXT) { req ->
      response.success = { resp, reader ->
        assert resp.statusLine.statusCode == 200
        System.out << reader // print response reader
      }
    }
  }
}
